<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/decorators/taglibs.jsp"%>
	<div class="container">
		<div class="row">
			<div class="col-md-1"><label class="text-primary">机器码</label></div>
			<div class="col-md-4">
				<input id="machine_id" type="text" class="form-control">
			</div>
			<div class="col-md-2">
				<button type="button" class="btn btn-primary" >生成</button>
			</div>
		</div>
		<br>
		<div class="row">
			<div class="col-md-1"><label class="text-info">激活码</label></div>
			<div class="col-md-4">
				<input id="activation_code" type="text" class="form-control" readonly="true">
			</div>
		</div>
	</div>
	<script>
	$(".btn-primary").click(function(){ 
		var machine_id =  $("#machine_id").val();
		if(machine_id == null || machine_id == "") return;
		$.ajax({
			type : "GET", 
			async: false, 
			url : "${ctx}/api/generate_code", 
			data : {
				machine_id : machine_id,
				time :new Date().getTime()
			},
			success : function(data) 
			{
				$("#activation_code").val(data);
			}
		});
    });
	</script>